<template>
  <n-popconfirm v-if="isTauri()" @positive-click="vitsStart" negative-text="取消" positive-text="确认">
    <template #trigger>
      <c-button class="headerBtn" quaternary :type="isStart ? 'primary' : undefined" :loading="loading"
        iconName="PictureFilled"></c-button>
    </template>
    {{ isStart ? '打开comfyUI窗口?' : '启动comfyUI?' }}
  </n-popconfirm>
</template>

<script setup lang='ts'>
const { isTauri } = Tauri
const { start, loading, isStart, openWebView } = useComfy()
const vitsStart = () => {
  if (isStart.value) {
    openWebView()
  } else {
    start()
  }
}
</script> 